﻿@inject IStringLocalizer<ButtonIsDisabled> Localizer

<div class="row g-3">
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Primary">@Localizer["PrimaryButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Secondary">@Localizer["SecondaryButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Success">@Localizer["SuccessButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Danger">@Localizer["DangerButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Warning">@Localizer["WarningButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Info">@Localizer["InformationButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Dark">@Localizer["DarkButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Light">@Localizer["HighlightButton"]</Button></div>
    <div class="col-6 col-sm-4 col-md-3 col-lg-auto"><Button IsDisabled="true" Color="Color.Link">@Localizer["LinkButton"]</Button></div>
</div>

<p class="mt-3">@((MarkupString)Localizer["Description1"].Value)</p>
<p>@((MarkupString)Localizer["Description2"].Value)</p>

<p><b>@Localizer["SubTitle"]</b></p>
<ul class="ul-demo mb-3">
    <li>@((MarkupString)Localizer["IsDisabledTip"].Value)</li>
    <li>@((MarkupString)Localizer["SetDisableTip"].Value)</li>
</ul>
<div class="row g-3">
    <div class="col-12">
        <Button Text="@Localizer["ButtonDisabled"]" OnClick="@ClickButton1" @ref="ButtonDisableDemo" IsDisabled="@IsDisable">
            <Tooltip Title="@Localizer["TooltiTitle"]" Placement="Placement.Top" Trigger="hover" />
        </Button>
        <Button Color="Color.Info" Text="@Localizer["ButtonAvailable"]" OnClickWithoutRender="@ClickButton2" class="ms-3"></Button>
    </div>
</div>

@code {
    private bool IsDisable { get; set; }

    [NotNull]
    private Button? ButtonDisableDemo { get; set; }

    private void ClickButton1()
    {
        IsDisable = !IsDisable;
        StateHasChanged();
    }

    private Task ClickButton2()
    {
        IsDisable = false;
        ButtonDisableDemo.SetDisable(false);
        return Task.CompletedTask;
    }
}
